


public class LogFunction extends Function{

	{
		order = 2;
	}

	public double evaluate(double[] vars){
		//TODO What to do when one of the inputs is 1. 
		double a = children.get(0).evaluate(vars);
		double b = children.get(1).evaluate(vars);
		if(a<=1 || b<=1)
			return 0;
		return Math.log10(a) / Math.log10(b);
	}

	public LogFunction deepCopy(){
		LogFunction returner = new LogFunction();
		for(Node myChild:this.children){
			returner.children.add(myChild.deepCopy());
		}
		for(Node otherChild:returner.children){
			otherChild.parent = returner;
		}
		returner.size = this.size;
		return returner;
	}
	
	public String toString() {
		return "log [base "+this.children.get(1)+"] ("+this.children.get(0)+" )";
	}
}